<template>
    <el-dialog v-model="dialogVisible" :title="$t('Group config sync')" width="800px">
        <el-table :data="tableData" style="width: 100%">
            <el-table-column prop="mac" label="Mac" />
            <el-table-column prop="ip" label="IP" />
            <el-table-column prop="status" :label="$t('Status')">
                <template #default="scope">
                    <el-icon v-if="scope.row.status == 'success'"><Check /></el-icon>
                    <el-icon v-if="scope.row.status == 'error'"><Close /></el-icon>
                    <el-icon v-if="scope.row.status == 'pending'"><More /></el-icon>
                </template>
            </el-table-column>
        </el-table>
        <template #footer>
            <span class="dialog-footer">
                <el-button @click="dialogVisible = false">{{ $t('Cancel') }}</el-button>
                <el-button type="primary" @click="ok">{{ $t('Start sync') }}</el-button>
            </span>
        </template>
    </el-dialog>
</template>
  
<script setup>
import { ElDialog } from "element-plus";
import RPC from "@/api/rpc"
import i18n from '@/lang'

const emits = defineEmits(["groupSync"])

const dialogVisible = ref(false)
const tableData = ref([])

const open = () => {
    RPC("group.getList", null).then(res => {
        tableData.value = res.data.result
        dialogVisible.value = true
    })
}
function ok() {
    emits('groupSync', tableData.value)
}
defineExpose({
    open
})
</script>
  
<style scoped></style>
  